package xyz.scootaloo.oj.ds.helper;

import xyz.scootaloo.oj.ds.ListNode;

/**
 * @author flutterdash@qq.com
 * @since 2021/4/9 18:22
 */
public class CollectionHelper {

    public static void showListNodes(ListNode head) {
        if (head == null) return;
        System.out.print("[");
        while (head.next != null) {
            System.out.print(head.val + ", ");
            head = head.next;
        }
        System.out.println(head.val + "]");
    }

    public static boolean intListMatch(int[] arr1, int[] arr2) {
        if (arr1 == arr2)
            return true;
        if (arr1 == null || arr2 == null)
            return false;
        if (arr1.length != arr2.length)
            return false;
        for (int i = 0; i<arr1.length; i++) {
            if (arr1[i] != arr2[i])
                return false;
        }
        return true;
    }

}
